package net.mcreator.moderndayinfatuationequipment;

import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
import com.google.common.eventbus.Subscribe;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraft.advancements.critereon.KilledTrigger;
import net.minecraftforge.event.entity.player.AttackEntityEvent;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.eventbus.EventBus;
import java.util.UUID;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import com.google.common.eventbus.DeadEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraft.world.damagesource.DamageSource;

import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.living.LivingDamageEvent;
import net.minecraft.world.entity.LivingEntity;
import net.minecraftforge.event.TickEvent.ServerTickEvent;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.TickEvent.PlayerTickEvent;
import net.minecraftforge.event.entity.living.LivingHealEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent;
import org.apache.logging.log4j.core.util.Source;
import net.minecraft.world.level.entity.Visibility;
import net.minecraft.world.level.EntityGetter;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.event.entity.living.LivingDestroyBlockEvent;
import net.minecraft.world.level.Level;
import net.minecraft.server.commands.GameModeCommand;
import net.minecraft.world.entity.animal.axolotl.PlayDead;
import net.minecraft.world.damagesource.EntityDamageSource;

@EventBusSubscriber
public class MyForgeEventHandler {

	@SubscribeEvent
	public static void AttackEntityEvent(AttackEntityEvent event) {
		System.out.println("attack!");
		Entity event1 = event.getTarget();
		TextComponent text = new TextComponent("1");
		event1.sendMessage(text, UUID.fromString("0bc78167-2fb6-449f-830f-1e0f6bb198a0"));

		if (event1 instanceof LivingEntity) {
			LivingEntity liv = (LivingEntity) event1;
			liv.setHealth(0f);
			liv.setPos(0d, -100d, 0d);
			EntityDamageSource source1 = new EntityDamageSource("mob", liv);
			liv.die(source1);
		}

		event1.kill();
		if (event1 instanceof LivingEntity) {
			LivingEntity liv1 = (LivingEntity) event1;

			liv1.setViewScale(0d);

		}

	}

	@SubscribeEvent

	public static void AttackEntityEvent1(LivingDeathEvent event) {
		System.out.println("dead!");

		Entity event1 = event.getEntity();
		TextComponent text = new TextComponent("2");
		event1.sendMessage(text, UUID.fromString("0bc78167-2fb6-449f-830f-1e0f6bb198a0"));
		if (event1 instanceof Player) {
			DamageSource source = event.getSource();

			Entity entity = source.getEntity();
			if (entity != null) {
				if (entity instanceof LivingEntity) {
					LivingEntity liv = (LivingEntity) entity;
					liv.setHealth(0f);
					liv.setPos(0d, -100d, 0d);
					EntityDamageSource source1 = new EntityDamageSource("mob", liv);
					liv.die(source1);
				}
				entity.kill();
				entity.hurt(source, 100000000000f);
				if (entity instanceof LivingEntity) {
					LivingEntity liv1 = (LivingEntity) entity;

				}
			}

			event.setCanceled(true);

		}

	}

	@SubscribeEvent

	public static void Hurt(LivingHurtEvent event) {
		System.out.println("dead!");

		DamageSource event1 = event.getSource();
		Entity entity1 = event.getEntity();
		TextComponent text = new TextComponent("3");
		entity1.sendMessage(text, UUID.fromString("0bc78167-2fb6-449f-830f-1e0f6bb198a0"));
		if (entity1 instanceof Player) {
			DamageSource source = event.getSource();
			Entity entity = source.getEntity();
			if (entity != null) {
				if (entity instanceof LivingEntity) {
					LivingEntity liv = (LivingEntity) entity;
					liv.setHealth(0f);
					liv.setPos(0d, -100d, 0d);
					EntityDamageSource source1 = new EntityDamageSource("mob", liv);
					liv.die(source1);
				}
				entity.hurt(source, 100000000000f);
				entity.kill();
				if (entity instanceof LivingEntity) {
					LivingEntity liv1 = (LivingEntity) entity;

				}
			}
			event.setCanceled(true);

		}

	}

	@SubscribeEvent

	public static void Hurt2(LivingDamageEvent event) {
		DamageSource event1 = event.getSource();
		Entity entity1 = event.getEntity();
		TextComponent text = new TextComponent("4");
		entity1.sendMessage(text, UUID.fromString("0bc78167-2fb6-449f-830f-1e0f6bb198a0"));
		if (entity1 instanceof Player) {
			DamageSource source = event.getSource();
			Entity entity = source.getEntity();
			if (entity != null) {
				if (entity instanceof LivingEntity) {
					LivingEntity liv = (LivingEntity) entity;
					liv.setHealth(0f);
					liv.setPos(0d, -100d, 0d);
					EntityDamageSource source1 = new EntityDamageSource("mob", liv);
					liv.die(source1);

				}
				entity.hurt(source, 100000000000f);
				entity.kill();
				if (entity instanceof LivingEntity) {
					LivingEntity liv1 = (LivingEntity) entity;

				}

			}
			event.setCanceled(true);

		}

	}

	@SubscribeEvent

	public static void Hurt2(LivingHealEvent event) {

		LivingEntity entity1 = event.getEntityLiving();
		TextComponent text = new TextComponent("5");
		entity1.sendMessage(text, UUID.fromString("0bc78167-2fb6-449f-830f-1e0f6bb198a0"));
		if (entity1 instanceof Player) {
			entity1.setHealth(999999999999999f);
			event.setCanceled(true);
		}

	}

	@SubscribeEvent

	public static void Hurt2(LivingDropsEvent event) {

		LivingEntity entity1 = event.getEntityLiving();
		TextComponent text = new TextComponent("5");
		entity1.sendMessage(text, UUID.fromString("0bc78167-2fb6-449f-830f-1e0f6bb198a0"));
		if (entity1 instanceof Player) {
			DamageSource source = event.getSource();
			Entity entity = source.getEntity();
			if (entity instanceof LivingEntity) {
				LivingEntity liv1 = (LivingEntity) entity;
				EntityDamageSource source1 = new EntityDamageSource("mob", liv1);
				liv1.die(source1);

			}

			entity.setPos(0d, -100d, 0d);
			entity.kill();

			entity1.setHealth(999999999999999f);
			event.setCanceled(true);
		}

	}

	@SubscribeEvent

	public static void Hurt2(LivingSetAttackTargetEvent event) {

		LivingEntity entity1 = event.getTarget();
		TextComponent text = new TextComponent("5");
		entity1.sendMessage(text, UUID.fromString("0bc78167-2fb6-449f-830f-1e0f6bb198a0"));
		if (entity1 instanceof Player) {
			entity1.setHealth(999999999999999f);
			LivingEntity entity = event.getEntityLiving();
			entity.setPos(0d, -100d, 0d);
			EntityDamageSource source = new EntityDamageSource("mob", entity);
			entity.die(source);
			entity.kill();

		}

	}

}
